package org.hhchat.leetcode.math;

public class code633_easy {
    static class Solution {
        public boolean judgeSquareSum(int c) {
            int s = 0;
            int f = (int) Math.sqrt(c);

            while(s<=f){
                int cur = s * s + f * f;
                if (cur == c) {
                    return true;
                } else if (cur < c) {
                    s++;
                }else{
                    f--;
                }
            }
            return false;
        }
    }
}
